<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let num=Math.floor(Math.random()*10)
        let sum= +prompt('请输入你猜测的数：')
        while(true){
            if(sum>num){
                alert('猜大了，请重新猜测')
                sum= +prompt('请输入你猜测的数：')
            }
           else if(sum<num){
            alert('猜小了，请重新猜测')
            sum= +prompt('请输入你猜测的数：')
           }
           else{
            alert('恭喜你，猜对了')
              break
           }
        }
    </script>
</body>
</html>